/**
 * Bakalarska prace - Inteligentni budik
 * @package sleepCatcher
 * @file SCAlarm.h
 * @author Jan Pesava - xpesav00
 * @email xpesav00@stud.fit.vutbr.cz
 * @date 24. 12. 2011
 */

#ifndef SCALARM_H_
#define SCALARM_H_

#include "models/SCBaseModel.h"
#include "models/SCAlarmRepeat.h"

enum AlarmAwakeType {AWAKE_TYPE_SOUND, AWAKE_TYPE_VIBRATION, AWAKE_TYPE_SOUND_VIBRATION};
enum AlarmSoundLevel {SOUND_LEVEL_MIN = 0, SOUND_LEVEL_MAX = 10, SOUND_LEVEL_CENTER = 5, SOUND_LEVEL_DEFAULT = 7};


class SCAlarm : public SCBaseModel
{

// Constructor
public:
	SCAlarm();
	SCAlarm(int id);
	result Construct();
	virtual ~SCAlarm();

// Constants

// Attributes
private:
	DateTime time;
	SCAlarmRepeat *pAlarmRepeat;
	String name;
	String awakeSound;
	int soundLevel;
	int awakeType;
	bool active;

// Methods
public:
	DateTime GetTime();
	void SetTime(DateTime time);
	SCAlarmRepeat *GetAlarmRepeat();
	void SetAlarmRepeat(SCAlarmRepeat *pAlarmRepeat);
	String GetName();
	void SetName(String name);
	String GetAwakeSound();
	void SetAwakeSound(String sound);
	int GetSoundLevel();
	void SetSoundLevel(int level);
	int GetAwakeType();
	void SetAwakeType(int type);
	bool GetActive();
	void SetActive(bool active);
	void Ring();
	bool IsActive();
	bool IsActiveDay(int day);
	String GetAwakeTypeStr();
	void SetDefaultValues();
	void DeallocAlarmRepeat(SCAlarmRepeat* pAlarmRepeat);
	bool Load();
	bool Save();

// Statics
public:
	static ArrayList* GetAllAlarms();
	static SCAlarm* GetAlarm(int id = NULL);
	static void Delete(int id);
	static SCAlarm* GetFirstActive();
};

#endif /* SCALARM_H_ */
